
//
// 110515 - AH - Created.
//

package org.soekrat.gui.swing.chat.objectconversation;

import java.awt.BorderLayout;

import javax.swing.JTextField;

import org.soekrat.engine.Soekrat2Engine;
import org.soekrat.engine.pit.Pit;

/**
 * <p>
 *   {@link ConversationComponent} that is for showing plain text response in a
 *   {@link ObjectConversationPanel} which do not relate to 
 *   {@link Pit} content.
 * </p>
 * <p>
 *   Will be used for spare wheel reply.
 * </p>
 * @author Arne Halvorsen (AH)
 */
@SuppressWarnings("serial")
public final class PlainTextConversationPanel extends ConversationComponent 
{
  private JTextField m_textf=new JTextField();
  
  /**
   * <p>
   *   Constructor.
   * </p>
   * @param engine {@link Soekrat2Engine} interfaced.
   * @param txt    Text to show, if {@code null} shows the empty
   *               {@code String}.
   */
  public PlainTextConversationPanel(Soekrat2Engine engine, String txt)
  { 
    super(engine);
    
    txt=(txt==null) ? "" : txt.trim();
    
    setLayout(new BorderLayout());
    
    m_textf.setEditable(false);
    m_textf.setText(txt);
    add(m_textf, BorderLayout.CENTER);
  }
  
}
